cc.Class({
    extends: cc.Component,

    properties: {
        itemNode: cc.Node,
    },

    onLoad () {
        this.itemBox = this.itemNode.parent;
        this.itemNode.parent = null;
    },

    addItem(data) {
        var node = cc.instantiate(this.itemNode);
        node.parent = this.itemBox;
        node.getComponent(cc.Sprite).loadImage(data.appIcon);
        var btn = node.find('btnBuy');
        btn.find('price', cc.Label).string = data.price;
        btn.on('click', () => cc.Proxy.gameCharge(data));
    },
});
